-
Notifications
You must be signed in to change notification settings - Fork 2
Improve gas coord state compact #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…act state structure
⛽ Gas Usage ChangesComparison against Click to view gas difftest_getCoordStorage_IsIsolated() (gas: +442 (2.141%))
test_getAuthStorage_IsIsolated() (gas: +479 (2.351%))
test_getTxStorage_IsIsolated() (gas: +541 (2.624%))
test_handleAck_RevertWhen_StateNotFound() (gas: +10340 (8.294%))
test_handleAck_RevertWhen_CoordinatorStateNotFound() (gas: -28202 (-9.080%))
test_runTx_RevertWhen_ChannelNotFound() (gas: +10341 (12.197%))
test_runTx_RevertWhen_UnexpectedReturnValue() (gas: +10339 (14.453%))
test_handleAck_RevertWhen_ChannelNotFound() (gas: -47440 (-14.819%))
test_handleAck_RevertWhen_ChannelMismatch() (gas: -48842 (-15.200%))
test_runTx_SucceedsAndSendsPacket() (gas: -52145 (-15.248%))
test_handleAck_RevertWhen_CoordinatorPhaseNotPrepare() (gas: -46608 (-15.259%))
test_handleAck_RevertWhen_InvalidTxIDLength() (gas: -50969 (-15.592%))
test_handleAck_RevertWhen_PacketTypeURLUnexpected() (gas: -50969 (-16.139%))
test_handleAck_RevertWhen_PacketPayloadDecodeFailed() (gas: -50969 (-18.320%))
test_handleAck_RevertWhen_AllTransactionsConfirmed() (gas: -68764 (-19.507%))
test_handleAck_RevertWhen_AckTypeURLUnexpected() (gas: -50969 (-19.628%))
test_handleAck_RevertWhen_UnexpectedCommitStatus() (gas: -69218 (-20.295%))
test_handleAck_RevertWhen_AckPayloadDecodeFailed() (gas: -50969 (-21.041%))
test_handleAck_RevertWhen_AckIsNotSuccess() (gas: -50969 (-21.988%))
test_runTx_RevertWhen_TxIDAlreadyExists() (gas: -46545 (-22.353%))
test_handleAck_Failure() (gas: -110057 (-24.342%))
test_handleAck_Success() (gas: -110052 (-24.362%))
test_handleAck_RevertWhen_OnAbortReverts() (gas: -109903 (-24.433%))
test_handleAck_RevertWhen_OnCommitReverts() (gas: -109898 (-24.456%))
test_runTx_RevertWhen_Tx0NotLocal() (gas: +10337 (24.685%))
test_handleAck_RevertWhen_CoordinatorStateInconsistent() (gas: -108401 (-26.267%))
test_getCoordinatorState_ReturnsCorrectState() (gas: -20150 (-27.140%))
test_handleAck_RevertWhen_CoordinatorTxStatusNotPrepare() (gas: -109933 (-27.411%))
test_handleAck_RevertWhen_ModuleNotInitialized() (gas: -109900 (-27.820%))
test_runTx_RevertWhen_ModuleNotInitialized() (gas: +10338 (28.114%))
test_runTx_PrepareFailed() (gas: -91896 (-30.835%))
test_runTx_RevertWhen_LinksNotSupported() (gas: +10337 (36.922%))
test_getCoordinatorState_RevertsIfNotFound() (gas: +10211 (56.274%))
Overall gas change: -1520063 (-0.141%)
Calculated by Foundry Gas Snapshot Action |
LCOV of commit
|
mattsu6666
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment!
| string participantChannel; | ||
|
|
||
| uint8 confirmedMask; // bit0=coord, bit1=participant | ||
| uint8 ackMask; // bit0=coord, bit1=participant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to add a comment clarifying that this struct is only intended for a 1:1 relationship between the coordinator and the participant. It would also be good to note that introducing 2PC would require a redesign.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: 8c538ed
mattsu6666
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Introduced
CoordStateCompactto replace the proto-generatedCoordinatorState.Datain storage. This allows us to pack protocol, phase, decision, and masks into a single slot.